package com.hl.card.modular.pack.service;

import com.alibaba.fastjson.JSONObject;
import com.hl.card.common.util.ResponseObject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.io.IOException;
import java.math.BigInteger;

/**
 * java类简单作用描述
 *
 * @ProjectName: newcard
 * @Package: com.hl.card.modular.pack.service
 * @ClassName: ${TYPE_NAME}
 * @Description: java类作用描述
 * @Author: 作者姓名
 * @CreateDate: 2018/8/4 16:37
 * @UpdateUser: Neil.Zhou
 * @UpdateDate: 2018/8/4 16:37
 * @UpdateRemark: The modified content
 * @Version: 1.0
 * <p>Copyright: Copyright (c) 2018</p>
 */


@FeignClient("token-wallet")
public interface TokenWallet {
    /**
     * ERC20提币
     * @author skyhuihui
     * @version V1.0
     * @return JSONResult
     */
    @ResponseBody
    @RequestMapping(value = "/api/v1/account/erc20Withdraw")
    public ResponseObject erc20Withdraw(@RequestParam("userId") String userId, @RequestParam("address") String address, @RequestParam("currency") String currency, @RequestParam("amount") String amount);

    /**
     * 获取主账户余额
     * @author skyhuihui
     * @version V1.0
     * @return JSONResult
     */
    @ResponseBody
    @RequestMapping(value = "/api/v1/account/getMasterBalance")
    public ResponseObject getMasterBalance(@RequestParam("currency") String currency);

    /**
     * 获取用户账户余额
     * @author skyhuihui
     * @version V1.0
     * @return JSONResult
     */
    @ResponseBody
    @RequestMapping(value = "/api/v1/account/getUserAccountBalance")
    public ResponseObject getUserAccountBalance(@RequestParam("userId") String userId, @RequestParam("currency") String currency);

    /**
     * 获取用户以太坊地址信息
     * @author skyhuihui
     * @version V1.0
     * @return JSONResult
     */
    @ResponseBody
    @RequestMapping(value = "/api/v1/account/getEthAccountInfo")
    public ResponseObject getEthAccountInfo(@RequestParam("address") String address);

    /**
     * 获取用户以太坊地址
     * @author skyhuihui
     * @version V1.0
     * @return JSONResult
     */
    @ResponseBody
    @RequestMapping(value = "/api/v1/account/getEthAccount")
    public ResponseObject getEthAccount(@RequestParam("userId") String userId);

    /**
     * 获取ERC20代币合约地址列表
     * @author skyhuihui
     * @version V1.0
     * @return JSONResult
     */
    @ResponseBody
    @RequestMapping(value = "/api/v1/account/getERC20ContractAddressList")
    public ResponseObject getERC20ContractAddressList();

    /**
     * 用户提现 以太币
     * @author skyhuihui
     * @version V1.0
     * @return JSONResult
     */
    @ResponseBody
    @RequestMapping(value = "/api/v1/account/ethWithdraw")
    public ResponseObject ethWithdraw(@RequestParam("userId") String userId, @RequestParam("account") String account, @RequestParam("amount") String amount) throws IOException;

    /**
     * 钱包归集
     * @author skyhuihui
     * @version V1.0
     * @return JSONResult
     */
    @ResponseBody
    @RequestMapping(value = "/api/v1/account/erc20Collection")
    public ResponseObject erc20Collection(@RequestParam("userId") String userId, @RequestParam("currency") String currency) throws IOException;

    /**
     * 获取代币精度
     * @author skyhuihui
     * @version V1.0
     * @return JSONResult
     */
    @ResponseBody
    @RequestMapping(value = "/api/v1/account/getTokenDecimals")
    public ResponseObject getTokenDecimals(@RequestParam("currency") String currency) throws IOException;

    /**
     * 根据hash查询交易明细
     * @author skyhuihui
     * @version V1.0
     * @return JSONResult
     */
    @ResponseBody
    @RequestMapping(value = "/api/v1/account/getTransInfo")
    public String getTransInfo(@RequestParam("hash") String hash);

    /**
     * 检查提币操作是否是内部交易，并处理
     * @author skyhuihui
     * @version V1.0
     * @return JSONResult
     */
    @ResponseBody
    @RequestMapping(value = "/api/v1/account/checkInnerTrans")
    public ResponseObject checkInnerTrans(@RequestParam("transOrderId") String transOrderId);
}
